// test passed
import axios from "../../src";

axios.interceptors.request.use((config) => {
  config.headers.test += "1";
  return config;
});

axios.interceptors.request.use((config) => {
  config.headers.test += "2";
  return config;
});

axios.interceptors.request.use((config) => {
  config.headers.test += "3";
  return config;
});

axios.interceptors.response.use((res) => {
  res.data += "1";
  return res;
});

let interceptor = axios.interceptors.response.use((res) => {
  res.data += "2";
  return res;
});

axios.interceptors.response.use((res) => {
  res.data += "3";
  return res;
});

// 取消 += '2'
axios.interceptors.response.eject(interceptor);

axios({
  url: "/interceptor/get",
  method: "get",
  headers: {
    test: "", // "321"
  },
})
  .then((res) => console.log(res.data)) // hello13
  .catch((err) => console.log(err));
